1. Field of the Invention
The present invention relates to a focus detection device that is used on cameras, videos, and the like.
2. Background of the Related Art
Phase difference detection-type focus detection devices for cameras are commonly known. FIG. 14 is a schematic diagram of a conventional phase difference detection-type focus detection device. Incident light rays from area 101 of the photo lens 100 pass a field of field mask 200, a field lens 300, an aperture stop 401, and an re-imaging lens 501. The rays are then composed into an image on an image sensor array A. The photoelectric converting elements are arranged linearly to form a row and generate outputs according to the incident light intensity. In the same manner, incident light rays from area 102 of the photo lens 100 pass the field of field mask 200, the field lens 300, an aperture stop 402, and an re-imaging lens 502, and are composed into an image on an image sensor array B.
The pair of subject images composed on the image sensor array rows A and B diverge in the so-called front focus condition, in which the photo lens 100 forms a clear image of the subject in front of a predetermined focus surface. The pair of subject images converge in the so-called back focus condition, in which a clear image of the subject is formed behind the predetermined focus surface. In a focused condition, a clear image of the subject is formed exactly at the predetermined focus surface and the subject images on the image sensor array row A and row B coincide relative to each other.
The pair of subject images on image sensor array rows A and B undergo photoelectric conversion and are converted to electrical signals. By mathematically processing these signals, the relative positions of the two subject images can be calculated, and the focus adjustment condition, i.e., the amount and direction of separation from the focused condition of the object lens 100 (referred to hereafter as "the defocus amount") can be determined.
The projected images formed by the re-imaging lenses 501,502 on the image sensor array rows A and B, respectively, overlap in the vicinity of a predetermined focus surface. As shown in FIG. 13, this area of overlap is generally the area shown by the dotted lines in the central region of the photographic field, and is referred to as the "focus detection area."
The mathematical processing method for calculating the defocus amount is described next.
The image sensor array rows A and B each comprise a plurality of photoelectric converting elements having a plurality of output signal strings a[1], . . . ,a[n] and b[1], . . . ,b[n], respectively (refer to FIGS. 15(a), 15(b)). Correlation calculations are carried out while the data in a specified area within the pair of output signal strings of rows A and B are shifted a fixed amount. The L range, i.e., data line shift amount range, in which a maximum shift number is taken to be lmax, becomes -lmax to lmax. Specifically, the correlation amount C [L] is calculated through the following Formula 1. EQU C [L]=.SIGMA..vertline.a[i+L]-b[i].vertline. (1)
where L=-lmax, . . . ,-2,-1,0,1,2, . . . ,lmax and .SIGMA. indicates the summation of i=k to r.
In Formula 1, L is an integer corresponding to the data line shift amount described above. The initial value k and the final value r depend on the shift amount L, as shown, for example, in the following Formula 2:
When L.gtoreq.0: EQU k=k0+INT {-L//2} EQU r=r0+INT {-L//2} PA1 When L&lt;0: EQU k=k0+INT {(-L+1)/2} EQU r=r0+INT {(-L+1)/2} (2)
where k0 and r0 are the initial and final values, respectively, when the shift amount L is 0.
The combination of signals used to calculate the absolute value of the difference between the row A signals and the row B signal in Formula 1 when the initial value k and the final value r are calculated by Formula 2 are shown in FIGS. 16(a)-16(e). Thus, along with the change in the shift amount L, the ranges used for the correlation calculations for rows A and B shift in opposite directions relative to each other.
The initial value k and the final value r can also be set regardless of the shift amount L. In this case, the range used for the correlation calculation of one line is continually fixed, and only the other line shifts. Since the relative position shift amount becomes the shift amount L when a pair of data match, the shift amount which gives the local minimum correlation amount C[L] is determined. This amount, coupled with a constant determined by the optical system and the pitch width of the photoelectric converting elements of the image sensor arrays, becomes the defocus amount. Thus, the larger the maximum shift number lmax, the larger the defocus amount for which detection can be carried out.
The correlation amounts C[L] are scattered values, and the smallest unit of the defocus amount that can be detected is limited by the pitch width of the photoelectric converting elements of the image sensor array rows A and B. To overcome this limitation, a method is disclosed by the present assignee in Japanese Unexamined Patent Application Sho 60-37513 corresponding to U.S. Pat. No. 4,561,749, in which a new local minimum value Cex is calculated by interpolating from the scattered correlation amounts C[L]. The new local minimum value Cex is then used in carrying out detailed focus detection. As shown in FIG. 17, this method calculates the true local minimum value Cex and the shift amount Ls corresponding to Cex through Formula 3 and Formula 4, respectively, using the correlation amount C[l], i.e., the minimum value of the correlation amounts, and the correlation amounts C[l+1] and C[l-1], i.e., the shift amounts on either side of the correlation amount C [l]. EQU DL=(C[l-1]-C[l+1])/2 EQU Cex=C[l]-.vertline.DL.vertline. EQU E=MAX [{C[l+1]-C [l], C[l-1]-C[l]}] (3) EQU Ls=1+DL/E (4)
In Formula 3, MAX {Ca, Cb} means that the larger value of Ca and Cb is selected. The defocus amount DF is calculated from the above mentioned shift amount Ls according to Formula 5. EQU DF=Kf.times.Ls (5)
In Formula 5, Kf is a constant that depends on the optical system used and the pitch width of the photoelectric converting elements of the image sensor arrays.
It is also necessary to determine whether the defocus amount thus obtained indicates the true defocus amount, or whether the determined defocus amount is the result of noise or the like. A determined defocus amount that satisfies the following Formula 6 is considered to be reliable. EQU E&gt;E1 & Cex/E&lt;G1 (6)
where E1 and G1 are specified threshold values. The numerical value E is a value that indicates the changed state of the correlation amount and depends on the contrast of the subject; the larger the value, the higher the contrast and the higher the reliability. Cex is the difference when the pair of data most closely coincide, and is initially 0. However, due to the influence of noise and because of parallax generated by areas 101,102, Cex will not be 0. Because higher contrast results in a smaller influence from noise, Cex/E is used as the numerical value that indicates the degree of coincidence of a pair of data. Obviously, the closer the value of Cex/E is to 0, the higher the degree of coincidence of the data pair and the higher the reliability. Instead of the numerical value E, the contrast relating to one of the pair of data can be calculated and the reliability evaluation carried out using this calculated contrast.
When reliability is ascertained, the photo lens 100 is driven or a display is carried out based on the defocus amount DF. The above Formulas 1-6, consisting of correlation calculations, interpolation calculations, and conditional evaluations, are referred to, in general, as the focus detection calculations.
In the focused condition of the photo lens 100, since focus detection devices are generally structured so that a pair of data will coincide when the shift amount L is virtually 0, the photo lens 100 cannot be focused on the subject if the subject images are not formed in the range from the initial value k0 to the final value r0 of the image sensor array row A and row B. Therefore, the area in which focus detection is carried out is established through the initial value k0 and the final value r0. For example, if the initial value k0 and the final value r0 are taken to be a portion of the central area of the photographic field, the area in which focus detection is carried out becomes the area shown by the solid lines in the central area of the photographic field, as shown in FIG. 13. Hereafter, the data range from the initial value k0 to the final value r0 will be called the calculation range. The area corresponding to the calculation range in the photographic field is the focus detection area. The photographer can focus the photo lens on the desired subject by capturing the subject within the focus detection area.
The focus detection device may be provided with a switching device that can switch between a wide mode, which takes virtually the entire image sensor array as the focus detection area, and a spot mode, which takes the center portion of the sensor array as the focus detection area. In the wide mode, the initial value k0 and the final value r0 are set so that the calculating range will widen. In the spot mode, the initial value k0 and the final value r0 are set so that the calculation range will narrow.
The output signal strings a[1], . . . ,a[n] and b[1], . . . ,b[n] of the image sensor array rows A and B, respectively, may be directly used in the focus detection calculations. However, because there are cases in which a correct focus detection cannot be accomplished because of the presence of frequency components higher than the Nyquist frequency of the subject, or because of the influence of unbalanced outputs of rows A and B, filtering of the output data strings if preferred. A method is disclosed by the present assignee in Japanese Unexamined Patent Application Sho 61-245123 in which a filter calculation procedure is performed on the output signal strings. Focus detection calculations are then carried out using the obtained filter procedure data. For example, a filter procedure calculation that removes the high frequency components above the Nyquist frequency is achieved by Formula 7. The filter processing data Pa[1], . . . ,Pa[n-2] and Pb[1], . . . ,Pb[n-2] are obtained from the output signal strings a[1], . . . ,a[n] and b[1], . . . ,b[n] of the rows A and B, respectively. EQU Pa[i]=(a[i]+2xa[i+1]+a[i+2])/4 EQU Pb[i]=(b[i]+2xb[i+1]+b[i+2])/4 (7)
where i=1 to n-2.
A subsequent filter procedure calculation is performed on the filter processing data Pa[1], . . . ,Pa[n-2] and Pb[1], . . . ,Pb[n-2] which removes the influence of unbalanced outputs of the row A and the row B. This calculation is carried out, for example, according to Formula 8, and the filter processing data Fa[1], . . . ,Fa[n-2-2s] and Fb[1], . . . ,Fb[n-2-2s] are obtained. EQU Fa[i]=-Pa[i]+2xPa[i+s]-Pa[i+2s] EQU Fb[i]=-Pb[i]+2xPb[i+s]-Pb[i+2s] (8)
where i=1 to n-2-2s
In Formula 8, s is an integer from 1 to 10. The higher the numerical value, the lower the frequency component that is extracted from the subject pattern; the lower the numerical value, the higher the frequency component that is extracted from the subject pattern. In addition, the number of filter processing data decreases as s increases.
Since the subject image includes more high frequency components as the focused condition is approached, it is desirable to have a comparatively small value for s; and since the subject image blurs in the un-focused condition and has only low frequency components, a large value of s is desirable. Therefore, when s is small, since the low frequency components are not extracted, detection becomes impossible when the defocus amount is large. In this case, it is meaningless to have a very large maximum shift number lmax in Formula 1; a comparatively small value will suffice. Conversely, when s is large, detection is possible even when the defocus amount is large because the low frequency components are extracted. Therefore, a comparatively large value is set for lmax.
In addition, when the value of s is comparatively large, the filter processing data Fa[i] and Fb[i] obtained through Formula 8 may each be halved by taking every other datum. When this is done, since 2 pixel widths are held in one datum, only half the calculation range is needed for the same focus detection area. Since shift amount 1 of the case where the data is halved corresponds to shift amount 2 of the case where the data is not halved, a defocus amount of the same size can be detected even though the maximum shift number is only half.
FIGS. 18(a)-18(c) graphically illustrate a subject pattern that is formed only from low frequency components. FIG. 18(a) displays the output signal, FIG. 18(b) displays the filter processing data with s=2, and FIG. 18(c) displays the filter processing data with s=8. Since the system is in the focused condition in these drawings, the row A output signal string and the row B output signal string overlap. As shown in the figures, the filter processing data with s=2 has virtually no contrast and is virtually flat. When s=8, the contrast becomes sufficient and a reliable defocus amount can be obtained. As shown in FIG. 18(c), since the wide calculating range ce2 includes more contrast than the narrow calculating range ce1, ce2 is more advantageous for focus detection calculations. In other words, the wider calculating range is desirable for filter processing data for which low frequency components are extracted.
FIGS. 19(a)-19(c) graphically illustrate an example of a subject pattern that is formed only by high frequency components. FIG. 19(a) shows the output signal, FIG. 19(b) shows the filter processing data with s=2, and FIG. 19(c) shows the filter processing data with s=8. Since the system is in the focused condition in these drawings, the row A output signal string and the row B output signal string overlap. In this case, sufficient contrast is obtained by filter processing data with s=2, and a reliable defocus amount can be obtained. In FIG. 19(b), when the narrow calculating range ce1 and the wide calculating range ce2 are compared, the contrast is the same for both. However, the influence of noise is less for the narrow calculating range. Further, if the range is too wide, multiple subjects with different distances may exist within the calculating range making focus detection impossible. Therefore, it is desirable to use a comparatively narrow calculating range for the filter processing data having high frequency components extracted.
FIGS. 20(a)-20(c) graphically illustrate an example of a subject pattern that includes adequate high frequency and low frequency components. FIG. 20(a) shows the output signal, FIG. 20(b) shows the filter processing data with s=2, and FIG. 20(c) shows the filter processing data with s=8. Since the system is in the focused condition in these drawings, the row A output signal string and the row B output signal string overlap. In this example, sufficient contrast may be obtained regardless of the value of s. In addition, as s increases, the range over which the contrast of the subject pattern is distributed becomes wider.
FIGS. 21(a)-21(c) graphically illustrate a case in which the defocus amount is large. This is the image sensor output which would occur, for example, in the case of a subject such as a chimney. FIG. 21(a) shows the output signal, FIG. 21(b) shows the filter processing data with s=2, and FIG. 21(c) shows the filter processing data with s=8. In addition, the solid line shows the output signal string of the row A, and the dashed line shows the output signal string of the row B. Thus, since virtually no high frequency components are included when the defocus amount is large, no contrast can be obtained by filter processing data with s=2. However, sufficient contrast can be obtained through filter processing data with s=8. The maximum shift number lmax is given a sufficiently large value, and the defocus amount can be detected.
Since the frequency components differ according to the subject pattern, s is initially set to s=2 and a filtering process is carried out that extracts high frequency components. The focus detection calculations of Formulas 1-6 are carried out using this filter processing data, and if a reliable defocus amount is obtained, the focus detection action stops. If a reliable defocus amount is not obtained, s is changed to 4 and a filtering process is carried out that extracts lower frequency components. The focus detection calculations of Formula 1-6 are then repeated using this filter processing data. The value of s is increased through this type of process until a reliable defocus amount is obtained.
According to the above method, since high frequency components are extracted first, in subject patterns that are near the normal focused condition of the subject, such as the subject pattern shown in FIG. 20(a), a reliable defocus amount can be obtained. When the subject consists only of low frequency components, e.g. a human face, and has for example a subject pattern such as that shown in FIG. 18(a), the focus detection calculations are carried out based on filter processing data having low frequency components extracted. As shown in FIGS. 21(a)-21(c), in the case of a large defocus amount, filter processing data having low frequency components extracted are used. The maximum shift number lmax is increased, the focus detection calculations are carried out, and the defocus amount can be detected. Since the calculation time is shortened near the focused condition, the subject can be easily followed even when the subject is a moving object.
For those focus detection devices that do not perform a filter process and instead directly use the output signal strings, or which only use a filter process that removes frequency components that are higher than a specific frequency, e.g the Nyquist frequency, a wide focus detection area is desirable for subject patterns that consists only of low frequency components, and a comparatively narrow focus detection area is desirable for subject patterns that include high frequency components. Therefore, the focus detection calculations are first carried out with a narrow focus detection area, and then, if a reliable defocus amount is not obtained, the focus detection calculations are carried out again with a wide focus detection area.
With the focus detection devices described above, the following problems may arise.
First, when the focus detection device switches the type of filter process for the output signal strings of the image sensors, proper ranges are provided for each filter process. However, the photographer may mistake the widest calculating range among these ranges for the focus detection area. For example, in the pattern shown in FIG. 20(a), since the filter processing data for s=2 has sufficient contrast in the calculation range established by the initial value k0 and the final value r0, as shown in FIG. 20 (b), a reliable defocus amount can be obtained. However, if the subject pattern shown in FIG. 20(a) is shifted, such as shown in FIG. 22(a), the range of filter processing data does not have any contrast in the calculation range established by the initial value k0 and the final value r0 as shown in FIG. 22(b). Consequently, a reliable defocus amount cannot be obtained for s=2. However, as shown in FIG. 22(c), using filter processing data with s=8, since the contrast range widens into the range established by the initial value k0 and the final value r0, sufficient contrast exists and a reliable defocus amount is obtained. Thus, the photographer is given a wide calculation range appropriate for filter processing data having low frequency components extracted, and can distinguish the focus detection area from the portion in which the range with contrast is widened through filter processing.
Even when the value of s is set to be optimal for a subject pattern, the calculated result for a subject pattern that consists only of low frequency components generally has a lower precision than the calculated result for a subject pattern that includes high frequency components. As described above, in filter processing with a comparatively large value of s, when the number of filter processing data Fa[i] and Fb[i] is halved, since two pixel widths are held in one datum, the precision of the interpolation calculations of Formulas 3 and 4 decreases and results in a noticeable decline in focus detection precision. Further, in the case shown in FIG. 22(c), since not all of the subject contrast is inside the calculation range, a defocus amount is obtained which is unstable. Consequently, a flickering display and so-called hunting in which the lens is slightly oscillated without stopping at the focused condition results.
When the subject pattern shown in FIG. 20(a) is moved gradually from the center of the photographic field toward the outside, a stable defocus amount is initially obtained from filter processing data with s=2. However, when contrast disappears from the calculation range, the defocus amount is then calculated based on filter processing data for which lower frequency components are extracted, and an unstable defocus amount is obtained. Furthermore, when the subject pattern is moved to the outside, the contrast included in the calculation range decreases, instability increases, and if the pattern is moved to far, focus detection becomes impossible.
If the narrow region corresponding to the calculation range for filter processing data having high frequency components extracted is taken as the focus detection area, and a focus detection frame is displayed on the finder screen of the camera, focus detection carried out outside the focus detection frame will result in a defocus amount that is unstable. On the other hand, if the wide region corresponding to the calculation range for filter processing data having low frequency extracted is taken as the focus detection area, and a focus detection frame is displayed on the finder screen of the camera, since focus detection is carried out while a portion of the subject contrast is outside the frame, instability results.
In focus detection devices that do not perform filter processing, or that only carry out filter processing that removes frequency components higher than the Nyquist frequency, the influence of noise is less in the narrow calculation range than in the wide calculation range. As a result, the defocus amount obtained through the wide calculation range becomes unstable compared to the defocus amount obtained through the narrow calculation range, and the same problem occurs as described above.
In focus detection devices in which it is possible to switch between a wide mode and a spot mode, the calculation ranges for filter processing having high frequency components extracted may be variable. However, when the calculation range for filter processing data having low frequency components extracted is narrowed because the device is in the spot mode, when the subject consists of low frequency components, the contrast included in the calculation range decreases by the amount that the calculation range has become narrow. This can result in an unstable defocus amount with focus detection becoming impossible, and different focus detection capabilities for subjects with only low frequency components in the wide and spot modes. Therefore, if one decides to continually use a wide calculation range regardless of the mode, the perceived focus detection area will widen as described above, even in the spot mode, and there will be virtually no difference from the focus detection area in the wide mode.
Another problem will be described using FIG. 23. FIG. 23 shows the image sensor output when focusing is performed on a subject such as two chimneys. The contrast is formed only at the two ends of the image sensor array. There is no contrast in the calculating range using data for which filter processing with s=2 is performed, and detection becomes impossible since the maximum shift number lmax is small. However, since the maximum shift number lmax is large for filter processing data with s=8, when the shift amount L is large, the right side row A contrast, for example, coincides with the left side row B contrast, and the defocus amount ends up being calculated based on the correlation amount at a large shift amount even though the system is in the focused condition. This results in so-called false focus, in which the photo lens focuses in an abnormally blurred condition.
This problem may be resolved by decreasing the maximum shift number lmax in the correlation calculation of Formula 1. However, with this solution, when the defocus amount is large as shown in FIG. 21, focus detection becomes impossible.